<template>
	<view>
		<view>
			<u-swiper :list="list3" indicator indicatorMode="line" circular></u-swiper>
		</view>
		<view>
			<u-cell-group>
				<u-cell title="任务中心" style="background-color:rgb(247,247,247) ;"></u-cell>
			</u-cell-group>
			<view class="u-page__item">
				<u-collapse accordion>
					<u-collapse-item :title="item.title" :name="item.id" v-for="item in taskList" :key="item.id">
						<u-cell :title="it.examPaperName" v-for="it in item.paperItems" :key="it.id">
							<u-tag slot="right-icon" v-if="it.status == 2" text="完成" plain size="mini"
								type="success"></u-tag>
							<u-tag slot="right-icon" v-if="!it.status" text="未完成" plain size="mini"
								type="error"></u-tag>
							<u-tag slot="right-icon" v-if="it.status == 1" text="待批改" plain size="mini"
								type="warning"></u-tag>
						</u-cell>
					</u-collapse-item>
				</u-collapse>
			</view>
		</view>




		<view>
			<u-cell-group>
				<u-cell title="固定试卷" style="background-color:rgb(247,247,247) ;"></u-cell>
			</u-cell-group>
			<view class="u-page__item">
				<u-collapse accordion>
					<u-cell :title="item.name" :name="item.id" v-for="item in fixedPaperList" :key="item.id">
					</u-cell>
				</u-collapse>
			</view>
		</view>
		
		<view>
			<u-cell-group>
				<u-cell title="推送试卷" style="background-color:rgb(247,247,247) ;"></u-cell>
			</u-cell-group>
			<view class="u-page__item">
				<u-collapse accordion>
					<u-cell :title="item.name" :name="item.id" v-for="item in pushPaperList" :key="item.id">
					</u-cell>
				</u-collapse>
			</view>
		</view>
		
		<view>
			<u-cell-group>
				<u-cell title="定时试卷" style="background-color:rgb(247,247,247) ;"></u-cell>
			</u-cell-group>
			<view class="u-page__item">
				<u-collapse accordion>
					<u-cell :title="item.name" :name="item.id" v-for="item in timeLimitPaperList" :key="item.id">
					</u-cell>
				</u-collapse>
			</view>
		</view>



	</view>
</template>

<script>
	import http from '../../http'
	export default {
		data() {
			return {
				list3: [
					"https://img0.baidu.com/it/u=3740105916,2691012398&fm=253&fmt=auto&app=120&f=JPEG?w=889&h=500",
					"https://img0.baidu.com/it/u=505852435,2465664512&fm=253&fmt=auto&app=120&f=JPEG?w=889&h=500",
					"https://img1.baidu.com/it/u=1184419679,1365597638&fm=253&fmt=auto&app=120&f=JPEG?w=889&h=500",
				],
				taskList: [],
				fixedPaperList: [],
				pushPaperList: [],
				timeLimitPaperList: []
			};
		},
		onLoad() {
			this.getTaskList();
			this.getPaperList()
		},
		methods: {
			getTaskList() {
				http({
					url: "/api/student/dashboard/task",
					method: "post",
				}).then(res => {
					console.log(res);
					if (res.code === 1) {
						this.taskList = res.response
					}
				})
			},
			getPaperList() {
				http({
					url: "/api/student/dashboard/index",
					method: "post",
				}).then(res => {
					console.log(res);
					if (res.code === 1) {
						this.fixedPaperList = res.response.fixedPaper;
						this.pushPaperList = res.response.pushPaper;
						this.timeLimitPaperList = res.response.timeLimitPaper;
					}
				})
			}
		}
	};
</script>

<style lang="scss">
	.u-page {
		padding: 0;

		&__item {

			&__title {
				color: $u-tips-color;
				background-color: $u-bg-color;
				padding: 15px;
				font-size: 15px;

				&__slot-title {
					color: $u-primary;
					font-size: 14px;
				}
			}
		}
	}

	.u-collapse-content {
		color: $u-tips-color;
		font-size: 14px;
	}

	.u-slot-title {
		display: flex;
		justify-content: space-between;
	}
</style>